﻿@model IEnumerable<Backend.JYD.Model.Cust.CustAddress>
@using Backend.JYD.Common
@using Backend.JYD.Model
@using Backend.JYD.Business;
@{
    ViewBag.Title = "客户地址信息";
    ViewBag.CurrMenu = "cmu2";
}
<div class="frame-tit">
    <span class="ico-left"></span>
    <div class="title">@ViewBag.Title</div>
    <span class="ico-right"></span>
    <div class="title-side blu line">
        <input type="button" onclick="openNew()" class="blu" value="创建营销任务"/>
    </div>
</div>
<div class="frame-cont">
    <p>
        <input type="button" onclick="openNew()" class="blu" value="创建营销任务"/>
    </p>
    <h2>营销记录</h2>
    <table class="table1" width="100%" border="0" cellpadding="0" cellspacing="1">
        <thead>
            <tr>
                <th width="3%"><div class="th1"></div></th>
                <th width="7%"><div class="th1">编号</div></th>
                <th width="7%"><div class="th1">客户号</div></th>
                <th width="7%"><div class="th1">任务编码</div></th>
                @*<th width="10%"><div class="th1">当前任务</div></th>*@
                <th width="7%"><div class="th1">状态</div></th>
                <th width="10%"><div class="th1">计划接触时间</div></th>
                <th width="7%"><div class="th1">有效期(天)</div></th>
                
                <th width="10%"><div class="th1">实际接触时间</div></th>
                <th width="10%"><div class="th1">接触方式</div></th>
                
                <th width="10%"><div class="th1">创建时间</div></th>
                <th width="10%"><div class="th1">修改时间</div></th>
                <th width="10%"><div class="th1">操作人</div></th>
                <th width="24%"><div class="th1">操作</div></th>
            </tr>
        </thead>
        <tbody>
        @if(Model != null)
        {
            int idx =0;
            string opName = string.Empty;
            var empInfos = this.ViewBag.EmpInfos as List<EmpInfo>;
            foreach (var item in Model)
            {
                idx++;
                
                if (empInfos != null && item.OpId.HasValue)
                {
                    var opInfo = empInfos.Find(p => p.EmpId == item.OpId);
                    if (opInfo != null)
                    {
                        opName = opInfo.EmpName;
                    }
                }
            <tr>
                <td>@idx</td>
                <td>@item.MarketingId</td>
                <td>@item.CustNo</td>
                <td>@(item.TaskId <= 0 ? "-" : item.TaskId.ToString())</td>
                @*<td>@(item.TaskDetailId <= 0 ? "-" : item.TaskDetailId.ToString())</td>*@
                <td>@(item.Status.HasValue ? TaskManager.GetTaskStatusCode(item.Status.Value) : "-")</td>
                <td>@String.Format("{0:g}", item.ScheduleTime)</td>
                <td>@item.ValidDays</td>
                <td>@String.Format("{0:g}", item.TouchTime)</td>
                <td>@item.Ways</td>
                @*<td title="@item.Remark">@(StringHelper.Truncate(item.Remark, 10,"..."))</td>*@
                <td>@String.Format("{0:g}", item.CreateTime)</td>
                <td>@String.Format("{0:g}", item.UpdateTime)</td>
                <td>@opName</td>
                <td>
                    <input type="button" value="查看" onclick="openShow(@item.MarketingId)" />
                    
                    @if (item.Status == 1)
                    {
                    <input type="button" value="修改" onclick="openEdit(@item.MarketingId)" />
                    <input type="button" value="处理" onclick="openCl(@item.MarketingId)" />
                    }
                </td>
            </tr>
            }
            }
        </tbody>
    </table>
 </div>
  <script src="/skin/datepicker/WdatePicker.js" type="text/javascript"></script>
 <script type="text/javascript">
     function loadpage() {
         window.location = window.location;
     }
     function openShow(id) {
         windowShowModalDialog("/address/details?id=" + id, window, 650, 430)
     }
     function openEdit(id) {
         windowShowModalDialog("/address/edit?id=" + id, window, 650, 420)
     }
     function openNew(tid, did) {
         if (tid && did) {
             windowShowModalDialog("/address/create?tid=" + tid + "&did=" + did, window, 650, 420)
         }
         else {
             windowShowModalDialog("/address/create", window, 650, 420)
         }
     }
 </script>
